package com.ztx.service.user;

import java.util.List;

import com.ztx.model.RoleVO;
import com.ztx.model.User;
import com.ztx.pagemodel.easyui.DataGrid;
import com.ztx.pagemodel.easyui.PageHelper;
import com.ztx.pagemodel.easyui.Tree;

public interface IUserService {

	public static final String BEAN_ID = "userService";

	/**
	 * 用户登录
	 * 
	 * @param username
	 * @param password
	 * @return
	 */
	public User login(String username, String password);

	/**
	 * 获取用户资源
	 * 
	 * @param id
	 * @return
	 */
	public List<String> resourceList(String id);

	/**
	 * 获取用户列表
	 * 
	 * @param user
	 * @param ph
	 * @return
	 */
	public DataGrid<User> userDataGrid(User user, PageHelper ph);

	/**
	 * 获取角色列表
	 * 
	 * @return
	 */
	public DataGrid<RoleVO> roleDataGrid(PageHelper ph, RoleVO role);

	/**
	 * 增加用户
	 * 
	 * @param user
	 * @throws Exception
	 */
	public void addUser(User user) throws Exception;

	/**
	 * 根据用户id查询用户角色
	 * 
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public List<Tree> getUserRoles(String userId) throws Exception;

	/**
	 * 保存用户角色信息
	 * 
	 * @param userId
	 * @param roleIds
	 * @throws Exception
	 */
	public void saveUserRole(String userId, String[] roleIds) throws Exception;

}
